package com.gx.enums;

/**
 * 数据字典
 * Created by gx on 2017/2/9.
 */
public enum  SeckillStatEnum {

    SUCCESS(1,"秒杀成功"),
    END(0,"秒杀结束"),
    REPEAT_KILL(-1,"重复秒杀"),
    INNER_ERROR(-1,"系统异常"),
    DATA_REWRITE(-3,"数据篡改");




    private int state;
    private String stateInfo;

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public void setStateInfo(String stateInfo) {
        this.stateInfo = stateInfo;
    }

    SeckillStatEnum(int state, String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }


    public static SeckillStatEnum stateof(int index){
        for (SeckillStatEnum seckillStatEnum : values()){
            if (seckillStatEnum.getState() == index){
                return seckillStatEnum;
            }
        }
        return null;
    }



}
